<html>
<head>
<title>event test</title>
<script>
function eventReport(name) {
    function report(e) {
       var keynum = null;
       if(window.event) // IE
       {
       e = window.event
       keynum = e.keyCode;
       }
       else if(e && e.which) // Netscape/Firefox/Opera
       {
       keynum = e.which;
       }
       text = "event "+name+" with keynum "+keynum;
       var reportElement = document.getElementById("report");
       reportElement.innerHTML = text;
    }
    return report;
}

var eventList = ["onabort", "onblur", "onchange", "onclick", "ondblclick",
   "onerror", "onfocus", "onkeydown", "onkeypress", "onkeyup", "onload",
   "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup",
   "onreset", "onresize", "onselect", "onsubmit", "onunload"];

function bindEvents(identity) {
    var element = document.getElementById(identity);
    var report = "binding "+identity+"<br>\n";
    for (var i=0; i<eventList.length; i++) {
        var event = eventList[i];
        try {
	     element[event] = eventReport(event);
             report += "bound event "+event+"<br>\n";
        }
        catch (E) {
             report += "failed to bind event "+event+"<br>\n";
        }
    }
    var reportElement = document.getElementById("report");
    reportElement.innerHTML = report;
}
</script>
</head>
<body>

<br>
input before: <input name="before">
testinput: <input name="testinput" id="testinput">
input after: <input name="after">

<br>
<span id="report">reporting area</span>

<script>
bindEvents("testinput");
</script>

</body>
</html>
